package com.yutian.springbootwebflux.handler;

import com.yutian.springbootwebflux.exception.CustomException;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

@Component
public class EchoHandler {

    public Mono<ServerResponse> echo(ServerRequest request) {
//        return ServerResponse.ok().body(request.bodyToMono(String.class), String.class);
//        return ServerResponse.ok().body(Mono.justOrEmpty(request.queryParam("name")), String.class);
        return Mono.error(new CustomException("CustomException"));
    }
}